package com.dayuanit.dy15.lesson28.demo4;

public class Test {

    public static void main(String[] args) throws Exception {
        //线程的优雅的死亡

        //通过信号来向线程发出死亡通知。这个信号我们称之为中断信号

        System.out.println(Thread.currentThread().getName() + " begin");

        BanZhuanRunnable runnable = new BanZhuanRunnable();

        Thread t1 = new Thread(runnable, "t1");

        t1.start();

        t1.join(10 * 1000);

        runnable.flag = false;
//        t1.interrupt();//向t1线程发送中断信号，t1线程不响应中断信号
//        t1.stop();//t1线程死掉了

        System.out.println(Thread.currentThread().getName() + " end");

    }
}
